﻿#region Using Directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace Nihongo
{
    internal class SentenceBuilder
    {
        private readonly List<ILanguageComponent> _sentenceComponents = new List<ILanguageComponent>();

        public void Append(ILanguageComponent sentenceComponent)
        {
            if (sentenceComponent == null)
            {
                throw new ArgumentNullException("sentenceComponent");
            }

            _sentenceComponents.Add(sentenceComponent);
        }

        public void Append(params ILanguageComponent[] sentenceComponents)
        {
            Append((IEnumerable<ILanguageComponent>)sentenceComponents);
        }

        public void Append(IEnumerable<ILanguageComponent> sentenceComponents)
        {
            foreach (ILanguageComponent sentenceComponent in sentenceComponents)
            {
                _sentenceComponents.Add(sentenceComponent);
            }
        }

        public Sentence ToSentence()
        {
            return new Sentence(_sentenceComponents);
        }
    }
}
